package com.xbongbong.saas.model;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.saas.domain.entity.RecheckingRuleEntity;

import java.util.List;

/**
 * 重复规则model层
 * @author yingfeng
 * @date 2022/11/7 16:09
 */
public interface RecheckingRuleModel extends IModel<RecheckingRuleEntity> {

    /**
     * @description 根据formid获取规则
     * @author yanglei
     * @date 2022/11/9 9:51
     * @param corpid
     * @param formId
     * @return RecheckingRuleEntity
     */
    RecheckingRuleEntity getRuleListByFormId(String corpid,Long formId,Integer businessType) throws XbbException;

    /**
     * @description 批量插入重复规则
     * @author yanglei
     * @date 2022/11/10 9:16
     * @param list
     */
    void insertBatch(List<RecheckingRuleEntity> list) throws XbbException;

    /**
     * @description 批量更新
     * @author yanglei
     * @date 2022/12/16 11:54
     * @param list
     */
    void updateBatch(List<RecheckingRuleEntity> list,String corpid) throws XbbException;

    /**
     * @description 批量插入重复规则脚本用（防止重复刷数据，效率低）
     * @author yanglei
     * @date 2022/11/10 9:16
     * @param list
     */
    void insertBatchByScript(List<RecheckingRuleEntity> list) throws XbbException;

    /**
     * @description 根据corpid,businessType判断业务是否开启常用查重规则
     * @author jiangren.li
     * @date 2022/11/15 9:51
     * @param corpid
     * @param businessType
     * @return RecheckingRuleEntity
     */
    Integer getNormalEnable(String corpid,Integer businessType) throws XbbException;

    /**
     * @description 重复规则的保存
     * @author yanglei
     * @date 2022/11/15 16:36
     * @return Integer
     */
    Integer save(RecheckingRuleEntity entity) throws XbbException;

    List<RecheckingRuleEntity> getByBusinessType(Integer businessType,String corpid);

    List<Long> getFormIdListByBusinessType(Integer businessType,String corpid);
}
